/**
 * @file pt_heap3.c
 * @author Linquan  
 * @brief 
 * @version 1.0
 * @date 2024-06-12
 * 
 * @copyright Copyright (c) 2024
 * 
 */

#include "FreeRTOS_heap3.h"
#if  FREE_RTOS_HEAP_3



#include <stdlib.h>
#include <stdint.h>

#if USE_MALLOC_FAILED_HOOK
__attribute__((weak)) void app_malloc_failed_hook( void )
{
    for (;;);
}
#endif

__attribute__((weak)) void heap_lock( void )
{
    
}

__attribute__((weak)) void heap_unlock( void )
{
    
}

/*-----------------------------------------------------------*/

void * pt_malloc( size_t size )
{
    void * ret;

    heap_lock();
    {
        ret = malloc( size );
    }
    ( void ) heap_unlock();

    #if ( USE_MALLOC_FAILED_HOOK == 1 )
    {
        if ( ret == NULL ) {
            app_malloc_failed_hook();
        }
    }
    #endif

    return ret;
}
/*-----------------------------------------------------------*/

void pt_free( void * pv )
{
    if( pv )
    {
        heap_lock();
        {
            free( pv );
        }
        ( void ) heap_unlock();
    }
}

void pt_heap_init(void)
{

}

size_t pt_get_free_size()
{
    
}

#endif
